//
//  CommentView.m
//  Tang
//
//  Created by 邓芮 on 15/12/9.
//  Copyright © 2015年 352324497@qq.com. All rights reserved.
//

#import "CommentView.h"

@interface CommentView ()
@property (nonatomic, strong) UIImageView *first;
@property (nonatomic, strong) UILabel *second;
@end

@implementation CommentView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width / 3 * 2, frame.size.height)];
        CGFloat x = 10 * KWidth / 414;
        self.first = [[UIImageView alloc]initWithFrame:CGRectMake(x, x, 40 * KWidth / 414, 40 * KWidth / 414)];
        self.first.layer.cornerRadius = 40 * KWidth / 414 / 2;
        self.first.layer.masksToBounds = YES;
        self.first.image = [UIImage imageNamed:@"happy"];
        [self.leftView addSubview:self.first];
        
        self.second = [[UILabel alloc]initWithFrame:CGRectMake(self.first.width + x * 2, x, self.leftView.width - self.first.x - self.first.width - x, 40 * KWidth / 414)];
        self.second.text = @"我来说两句";
        self.second.textAlignment = NSTextAlignmentCenter;
        self.second.backgroundColor = [UIColor lightGrayColor];
        self.second.alpha = 0.3;
        self.second.layer.cornerRadius = 8;
        self.second.layer.masksToBounds = YES;
        [self.leftView addSubview:self.second];
        
        self.like = [[DIYButton alloc]initWithFrame:CGRectMake(frame.size.width / 3 * 2 + 20 * KWidth / 414, 10 * KWidth / 414, frame.size.width / 3 - 35 * KWidth / 414, frame.size.height - 2 * x)];
        self.like.layer.cornerRadius = 12;
        self.like.layer.masksToBounds = YES;
        self.like.backgroundColor = [UIColor redColor];
        self.like.iconImageView.image = [UIImage imageNamed:@"xin"];
        self.like.textLabel.text = @"喜欢";
        self.like.textLabel.textColor = [UIColor whiteColor];
        self.like.selectIconImageView.image = [UIImage imageNamed:@"islike"];
        [self addSubview:self.leftView];
        [self addSubview:self.like];
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
